<?php 
namespace Home\Controller;
use Think\Controller;

class LoginController extends Controller{
	public function login(){
			if(IS_POST){
				$user = D('User');
				$map['username'] = $_POST['username'];
				$map['pass'] = md5($_POST['pass']);
				$info = $user->where($map)->find();
				
				if($info){
					$_SESSION['login'] = $info;
					$this->redirect('Index/index');
				}else{
					$this->error('用户名或密码错误！');
				}
			}else{
				$this->display();
			}
	}

	public function loginout(){
		unset($_SESSION['login']);
		$this->redirect('Index/index');
	}

	public function yzm(){
		$config =    array(  
		  'fontSize'    =>    25,    // 验证码字体大小   
		  'length'      =>    3,     // 验证码位数    
		  'useNoise'    =>    false, // 关闭验证码杂点
		  
		 );
		$Verify = new \Think\Verify($config);
		$Verify->entry();
	}




}


?>
